In this setup we're going to look at how to use tor as a DNS server.
root@tordns2:~# apt update -y ; apt upgrade -y ; apt install tor nyx -y
root@tordns2:~# vim /etc/tor/torrc
root@tordns2:~# head -n1 /etc/tor/torrc
DNSPort 0.0.0.0:53
root@tordns2:~# systemctl restart tor@default
root@tordns2:~# systemctl status tor@default
* tor@default.service - Anonymizing overlay network for TCP
Loaded: loaded (/lib/systemd/system/tor@default.service; enabled-runtime; vendor preset: enabled)
Active: active (running) since Thu 2023-06-15 16:10:58 UTC; 3s ago
Process: 61416 ExecStartPre=/usr/bin/install -Z -m 02755 -o debian-tor -g debian-tor -d /run/tor (code=exited, status=0/SUCCESS)
Process: 61417 ExecStartPre=/usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc --RunAsDaemon 0 --verify-config (code=exited, status=0/SUCCESS)
Main PID: 61419 (tor)
Tasks: 1 (limit: 115830)
Memory: 49.5M
CPU: 1.876s
CGroup: /system.slice/system-tor.slice/tor@default.service
`-61419 /usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc --RunAsDaemon 0
Jun 15 16:10:59 tordns2 Tor[61419]: Opened Socks listener connection (ready) on /run/tor/socks
Jun 15 16:10:59 tordns2 Tor[61419]: Opening Control listener on /run/tor/control
Jun 15 16:10:59 tordns2 Tor[61419]: Opened Control listener connection (ready) on /run/tor/control
Jun 15 16:10:59 tordns2 Tor[61419]: Bootstrapped 10% (conn_done): Connected to a relay
Jun 15 16:10:59 tordns2 Tor[61419]: Bootstrapped 14% (handshake): Handshaking with a relay
Jun 15 16:10:59 tordns2 Tor[61419]: Bootstrapped 15% (handshake_done): Handshake with a relay done
Jun 15 16:10:59 tordns2 Tor[61419]: Bootstrapped 75% (enough_dirinfo): Loaded enough directory info to build circuits
Jun 15 16:10:59 tordns2 Tor[61419]: Bootstrapped 90% (ap_handshake_done): Handshake finished with a relay to build circuits
Jun 15 16:10:59 tordns2 Tor[61419]: Bootstrapped 95% (circuit_create): Establishing a Tor circuit
Jun 15 16:11:00 tordns2 Tor[61419]: Bootstrapped 100% (done): Done
And then just test if the dns works:
root@tordns2:~# apt install bind-tools
root@tordns2:~# nslookup google.com 127.0.0.1
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: google.com
Address: 142.251.36.174
Name: google.com
Address: 2a00:1450:4016:808::200e
And it does!
Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8
Contact: nihilist@contact.nowhere.moe (PGP)